<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title></title>
	<script type="text/javascript" src="<%=basePath %>/bootstrap/js/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>/bootstrap/js/bootstrap.min.js"></script>
	<link rel="stylesheet" href="<%=basePath %>/bootstrap/css/bootstrap.min.css" />
	<style type="text/css">
		body{
			background-image:url("<%=basePath%>/bootstrap/img/14.jpg");
			 background-attachment :local; 
			 background-size: cover;
		}
		.well{
			width:280px;
			height:330px;
			margin-left:auto;
			margin-right:auto;
			margin-top:100px;
		}
		span{
			color:red;
		}
	</style>
</head>
<body>
	<c:if test="${param.code=='1001' }">
	 	<div style="color:red;width:100px;height:20px;margin-left:auto;margin-right:auto;margin-top:20px;">
	 		用户不存在
	 	</div>
	</c:if>
	<form class="well" action="login.action" method="post">
		<h3>登陆---CRM系统</h3>
		<hr />
	  <label>Email</label>
	  <input type="text" class="span3" id="email" name="user.email" /><br/>
	  <span class="name-error"></span>
	  <label>Password</label>
	  <input type="password" class="span3" id="password" name="user.password" /><br/>
	  <span class="password-error"></span>
	  <label>验证码:</label>
	<input type="text" name="yanzhengma"/><br/>
  	<img alt="yanzhengma" src="<%=basePath %>/jcaptcha.jpg" id="yanzheng" style="width:110px;height:40px;"/>
  	<br/>
  	<a href="javascript:;" id="yan">看不清请点击这里</a><br/>
	  <input type="button" class="btn btn-primary" id="bttn" value="submit"/>
	  <button type="reset" class="btn">Reset</button>
	  <a href="newuser.action">注册</a>
	</form>
	<input type="button" value="login" id="login" style="margin-left:700px;margin-top:400px;"/>
	<script type="text/javascript">
		//$(document).ready(function(){
			$(".well").hide();
			$("#login").click(function(){
				$(".well").show("slow");
				$("#login").hide("slow");
			});
			$("#yan").click(function(){
  				$("#yanzheng").attr("src","<%=basePath %>/jcaptcha.jpg?t="+new Date());
  			});
			$("#bttn").click(function(){
				var email = $("#email").val();
				var password = $("#password").val();
				var reg = /^\w+@\w+(\.\w+){1,2}$/;
				if(email.trim() == ""){
					$(".name-error").html("请输入email地址");
					return;
				}else if( !reg.test(email)){
					$(".name-error").html("email格式不正确");
				}else if(password == ""){
					$(".password-error").html("请输入密码");
					return;
				}else{
					$(".well").submit();
				}
			});
			
		//})；
</script>
</body>
</html>